package org.learn.java.map;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;

public class MyMap {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Map<String, Object> map = new HashMap<String, Object>(9,(float) 0.75);
		System.out.println(map.size());
	}

	// value
	public void mapValues() {
		Map<String, Object> map = new HashMap<String, Object>();
		Collection<Object> c = map.values();
		Iterator<Object> it = c.iterator();
		while (it.hasNext()) {
			System.out.println(it.next());
			;
		}
	}

	// key
	public void mapKey() {
		Map<String, Object> map = new HashMap<String, Object>();
		Set<String> key = map.keySet();
		for (Iterator iterator = key.iterator(); iterator.hasNext();) {
			String string = (String) iterator.next();
			System.out.println(map.get(string));
		}
	}

	// map实体
	public void mapEntity() {
		Map<String, Object> map = new HashMap<String, Object>();
		Set<Map.Entry<String, Object>> obj = map.entrySet();

		for (Iterator iterator = obj.iterator(); iterator.hasNext();) {
			Entry<String, Object> entry = (Entry<String, Object>) iterator
					.next();
			entry.getKey();
			entry.getValue();
		}
	}

}
